package com.googlecode.openrtp.spi.server.config;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.googlecode.openrtp.util.serviceloader.Service;

/**
 *
 * @author jocke
 */
@Service(AbstractModule.class)
public class ConfigModule extends AbstractModule {
    
    @Override
    protected void configure() {
        try {
            Names.bindProperties(binder(), load());
        } catch (IOException ex) {
            Logger.getLogger(ConfigModule.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public Properties load() throws IOException {
        Properties properties = new Properties();
        properties.load(getClass().getResourceAsStream("/config.properties"));
        return properties;
    }
}
